﻿using Dsl.Ped.AddIn.Java.Generated;

namespace Dsl.Ped.AddIn.Java.Helpers
{
    /// <summary>
    /// Helper methods of the <see cref="Method"/>
    /// </summary>
    public static class MethodHelper
    {
        /// <summary>
        /// Converts a <see cref="Method"/> object to the plain text
        /// </summary>
        /// <param name="javaMethod"><see cref="Method"/> object to be converted to a plain text</param>
        /// <param name="tabsCount">Number of tabs indents</param>
        /// <returns><see cref="javaMethod"/> converted to a plain text</returns>
        public static string ToPlainText(this Method javaMethod, int tabsCount)
        {
            var tabs = new string('\t', tabsCount);

            var constructorStr = tabs + javaMethod.name + "(" + javaMethod.parameters.ToPlainText(0) + ") {\r\n" + tabs + "}\r\n";
            return constructorStr;
        }
    }
}
